
function trim(val) {
	return val.replace(/(\s*$)/g, "");
}
function setProvince() {
	Ts_areaInfo.getAreaClassByUpId("000000000000000", function (data) {
		DWRUtil.removeAllOptions("province");
		DWRUtil.addOptions("province", {"":"\u8bf7\u9009\u62e9"});
		DWRUtil.addOptions("province", data);
	});
}
function setCitys(prov) {
	var provence = prov;
	Ts_areaInfo.getAreaClassByUpId(provence, function (data) {
		DWRUtil.removeAllOptions("eparchy_code");
		DWRUtil.addOptions("eparchy_code", {"":"\u8bf7\u9009\u62e9"});
		DWRUtil.addOptions("eparchy_code", data);
		DWRUtil.removeAllOptions("city_code");
		DWRUtil.addOptions("city_code", {"":"\u8bf7\u9009\u62e9"});
	});
}
function setAreas(city_id) {
	Ts_areaInfo.getAreaClassByUpId(city_id, function (data) {
		DWRUtil.removeAllOptions("city_code");
		DWRUtil.addOptions("city_code", {"":"\u8bf7\u9009\u62e9"});
		DWRUtil.addOptions("city_code", data);
	});
}
function subForm() {
	if (document.getElementById("user_name") != null) {
		if (document.getElementById("user_name").value == "") {
			alert("\u8bf7\u8f93\u5165\u7528\u6237\u540d\uff01");
			document.getElementById("user_name").focus();
			return false;
		}
		
		if (document.getElementById("cust_name").value == "") {
			alert("\u8bf7\u8f93\u5165\u771f\u5b9e\u59d3\u540d\uff01");
			document.getElementById("cust_name").focus();
			return false;
		}
		document.getElementById("real_name").value = document.getElementById("cust_name").value;
	}
	 var oi = /^\d{17}$/;
	 var license_no=document.getElementById("license_no").value;
	if(license_no!=null&&!oi.test(document.getElementById("license_no").value)){
		alert("请输入正确的职业证号");
		document.getElementById("license_no").focus();
		return false;
	}
	var reg = /^0{0,1}(13[0-9]|15[7-9]|153|156|18[7-9])[0-9]{8}$/;
	var cellphone= document.getElementById("cellphone").value;
	if (cellphone != "" &&cellphone.length!=11) {
		alert("\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u624b\u673a\u53f7\u7801\uff01");
		document.getElementById("cellphone").focus();
		return false;
	}
	var pon = /^((0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/;
	if (document.getElementById("phone").value != "" && !pon.test(document.getElementById("phone").value)) {
		alert("\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u7535\u8bdd\u53f7\u7801");
		document.getElementById("phone").focus();
		return false;
	}
	var regm = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})$/;
	if (document.getElementById("email").value != "" && !regm.test(document.getElementById("email").value)) {
		alert("\u90ae\u7bb1\u5730\u5740\u683c\u5f0f\u9519\u8bef\u6216\u542b\u6709\u975e\u6cd5\u5b57\u7b26!\n\u8bf7\u68c0\u67e5\uff01");
		document.getElementById("email").focus();
		return false;
	}
	if (document.getElementById("user_class").value == "") {
		alert("\u8bf7\u9009\u62e9\u4f1a\u5458\u7ea7\u522b\uff01");
		document.getElementById("user_class").focus();
		return false;
	}
	document.getElementById("cust_class").value = document.getElementById("user_class").value;
	var start_attr = "";
	if (document.getElementById("province").value != "") {
		start_attr = document.getElementById("province").value + "|";
	}
	if (document.getElementById("eparchy_code").value != "") {
		start_attr += document.getElementById("eparchy_code").value + "|";
	}
	if (document.getElementById("city_code").value != "") {
		start_attr += document.getElementById("city_code").value + "|";
	}
	if (start_attr != "") {
		document.getElementById("area_attr").value = start_attr;
	}
	document.addForm.submit();
}
function isNum() {
	if (isNaN(document.getElementById("phone").value)) {
		alert("\u5185\u5bb9\u5fc5\u987b\u662f\u6570\u5b57\uff01");
		document.getElementById("phone").value = "";
		document.getElementById("phone").focus();
		return false;
	}
	if (isNaN(document.getElementById("inter_num").value)) {
		alert("\u5185\u5bb9\u5fc5\u987b\u662f\u6570\u5b57\uff01");
		document.getElementById("inter_num").value = "";
		document.getElementById("inter_num").focus();
		return false;
	}
	if (isNaN(document.getElementById("cellphone").value)) {
		alert("\u5185\u5bb9\u5fc5\u987b\u662f\u6570\u5b57\uff01");
		document.getElementById("cellphone").value = "";
		document.getElementById("cellphone").focus();
		return false;
	}
	if (isNaN(document.getElementById("fax").value)) {
		alert("\u5185\u5bb9\u5fc5\u987b\u662f\u6570\u5b57\uff01");
		document.getElementById("fax").value = "";
		document.getElementById("fax").focus();
		return false;
	}
	if (isNaN(document.getElementById("qq").value)) {
		alert("\u5185\u5bb9\u5fc5\u987b\u662f\u6570\u5b57\uff01");
		document.getElementById("qq").value = "";
		document.getElementById("qq").focus();
		return false;
	}
	if (isNaN(document.getElementById("post_code").value)) {
		alert("\u90ae\u7f16\u5fc5\u987b\u662f\u6570\u5b57\uff01");
		document.getElementById("post_code").value = "";
		document.getElementById("post_code").focus();
		return false;
	}
}
function ChangeOrg() {
	document.getElementById("org1").style.display = "none";
	document.getElementById("org2").style.display = "inline";
	document.getElementById("org_id").value = "";
}
function searchForm() {
	document.indexForm.submit();
}
function oper(val) {
	var size = document.getElementById("listsize").value;
	var all_news_id = "";
	for (var i = 0; i < size; i++) {
		if (document.getElementById("checkone" + i).checked) {
			all_news_id += document.getElementById("checkone" + i).value + "|";
		}
	}
	document.getElementById("user_id").value = all_news_id;
	if (all_news_id == "") {
		alert("\u8bf7\u81f3\u5c11\u9009\u62e9\u4e00\u6761!");
		return false;
	} else {
		if (val == "0") {
			document.indexForm.action = "/doTradeReg.do";  //正常
			document.getElementById("state_code").value = "0";
			document.getElementById("trade_type_code").value = "1111";
			document.getElementById("bpm_id").value = "1111";
			document.indexForm.submit();
		} else {
			if (val == "1") {
				document.indexForm.action = "/doTradeReg.do";//禁用
				document.getElementById("state_code").value = "1";
				document.getElementById("trade_type_code").value = "1112";
				document.getElementById("bpm_id").value = "1112";
				document.indexForm.submit();
			}
		}
	}
}
function ChangeOrg() {
	document.getElementById("org1").style.display = "none";
	document.getElementById("org2").style.display = "inline";
	//document.getElementById("org_id").value = "";
}
function submitPasswd() {
	if (document.getElementById("passwd").value == "") {
		alert("\u8bf7\u586b\u5199\u7528\u6237\u5bc6\u7801\uff01");
		document.getElementById("passwd").focus();
		return false;
	}
	if (document.getElementById("c_passwd").value == "") {
		alert("\u8bf7\u586b\u5199\u786e\u8ba4\u5bc6\u7801\uff01");
		document.getElementById("c_passwd").focus();
		return false;
	}
	if (document.getElementById("passwd").value != document.getElementById("c_passwd").value) {
		alert("\u4e24\u6b21\u8f93\u5165\u7684\u5bc6\u7801\u4e0d\u4e00\u81f4\uff01");
		document.getElementById("c_passwd").value = "";
		document.getElementById("c_passwd").focus();
		return false;
	}
	document.addForm.submit();
}
function xiugai(){
	alert("只想能够");
	document.getElementById("sele").style.display="block";
	document.getElementById("area_attr").style.display="none";
}
function showDiv(val){
	if(val==1){
		if(document.getElementById("area_div").style.display=="none"){
			document.getElementById("area_div").style.display="block";
		}else{
			document.getElementById("area_div").style.display="none";
		}
	}else{
		if(document.getElementById("cat_div").style.display=="none"){
			document.getElementById("cat_div").style.display="block";
		}else{
			document.getElementById("cat_div").style.display="none";
		}
	}
	
}
